package com.ae.base;

import com.ae.base.net.ModNetWork;
import com.ae.base.placed.ItemPlaced;
import com.ae.base.register.BlockRegister;
import com.ae.base.register.TileRegister;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

@Mod(ModConstant.MOD_ID)
public class Base {
    public Base() {
        IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
        setUpPlaced();
        bus.addListener(this::setUpNet);
        ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, com.ae.base.ModConfig.CONFIG);
        ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, com.ae.base.ModConfig.CLIENT_CONFIG);
        BlockRegister.BLOCK.register(bus);
        TileRegister.TILE_ENTITY.register(bus);
    }

    public void setUpPlaced() {
        PlacedRegister.register(new ItemPlaced());
    }

    public void setUpNet(final FMLCommonSetupEvent event) {
        ModNetWork.register();
    }
}
